package control

import(
	"fmt"
	"project06/common/message"
	"encoding/json"
	"project06/client/utils"
)

type SmsControl struct{

}

func (this *SmsControl) sendGroupMes(content string) (err error){
	var mes message.Message
	var smsMes message.SmsMes
	mes.Type=message.SmsMesType
	
	smsMes.Content=content
	smsMes.User.UserId=curUser.UserId
	data,err:=json.Marshal(smsMes)
	if err!=nil{
		fmt.Println("序列化群发消息出错，err",err)
		return
	}
	mes.Data=string(data)
	data,err=json.Marshal(mes)
	if err!=nil{
		fmt.Println("序列化群发消息结构体出错，err",err)
		return
	}
	tf:=&utils.Transfer{
		Conn:curUser.Conn,
	}
	err=tf.WritePkg(data)
	if err!=nil{
		fmt.Println("发送群发消息出错，err",err)
		return
	}
	return
}